﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.ComponentModel;


namespace WpfSimpleDataBinding
{
    public class Person : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void Notify(string propName)
        {
            if (this.PropertyChanged != null)
            {
                Debug.WriteLine("Property Changed Fired :" + propName);
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
            }
        }

        string name;
        public string Name
        {
            get { return this.name; }
            set
            {
                if (this.name == value) { return; }
                this.name = value;
                Notify("Name");
            }
        }

        int age;

        public int Age
        {
            get { return this.age; }
            set
            {
                if (this.age == value)
                {
                    return;
                }
                this.age = value;
                Notify("Age");
            }

        }

        //public Person() { }
        //public Person(string name, int age)
        //{
        //    this.name = name;
        //    this.age = age;
        //}

    }
}